<template>
  <div class="feature-data">
    <h5 class="test-id-title">Test ID : {{test_id}}</h5>
    <div class="fn-fv" v-for="fd in features" :key="fd.feature_name">
      <h5>{{goodFeatueName(fd.feature_name)}}</h5>
      {{fd.value}}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object
    }
  },
  methods: {
    /**@param {String} s */
    goodFeatueName: s => {
      s = s.toUpperCase();
      if (s.includes("I30") || s.includes("U30") || s.includes("P30")) {
        s = s.replace("30", "s");
      }
      if (s.includes("I45") || s.includes("U45") || s.includes("P45")) {
        s = s.replace("45", "м");
      }
      if (s.includes("I50") || s.includes("U50") || s.includes("P50")) {
        s = s.replace("50", "в");
      }
      if (s == "SPEED") {
        s = "Se";
      }
      return s;
    }
  },
  computed: {
    test_id() {
      return this.data["test_id"];
    },
    features() {
      let arr = [];
      for (let f in this.data) {
        if (f != "test_id") {
          arr.push({
            feature_name: f,
            value: this.data[f]
          });
        }
      }
      return arr;
    }
  }
};
</script>

<style lang="scss">
.feature-data {
  color: #8391a5;
  h5.test-id-title {
    padding-bottom: 4px;
  }
  div.fn-fv {
    h5 {
      // display: list-item;
      text-decoration: underline;
    }
  }
}
</style>
